package com.ias.agdis_r.netservice.actions;

import android.content.Context;
import android.os.Handler;

import com.ias.agdis_r.R;
import com.ias.agdis_r.manager.DataBaseManager;
import com.ias.agdis_r.module.ParameterModel;
import com.ias.agdis_r.netservice.BaseService;
import com.ias.agdis_r.util.sdcard.WriteLog;

/**
 * 专网服务
 * 
 * @author wanghu
 * 
 */
public class PrivateNetService extends BaseService {

	private String sPrivateNetIp = null;
	private String sPttServerIp = null;
	private String last_CTT = "";
	private String last_LCT = "";
	private int localSocketPort = 0;
	private String localSocketIp = "";
	
	public PrivateNetService(Handler handler, Context context) {
		super(handler, context);
	}
	
	@Override
	public String getRestfulIP() {
		// TODO Auto-generated method stub
		String ip = DataBaseManager.getInstance().getString(
				ParameterModel.T_PRIVATE_INFO, ParameterModel.NET_IP_RESTFUL);
		WriteLog.getInstance().writeDebugLog(context.getString(R.string.DEBUG_PRIVATE_RESTFUL_IP)+ip);
		return ip;
	}

	@Override
	public String getPushIP() {
		String ip = DataBaseManager.getInstance().getString(
				ParameterModel.T_PRIVATE_INFO, ParameterModel.NET_IP_PUSH);
		WriteLog.getInstance().writeDebugLog(context.getString(R.string.DEBUG_PRIVATE_PUSH_IP)+ip);
		return ip;
	}

	@Override
	protected int getPushPort() {
		WriteLog.getInstance().writeDebugLog(context.getString(R.string.DEBUG_PRIVATE_PUSH_PORT)+DataBaseManager.getInstance().getInt(
				ParameterModel.T_PRIVATE_INFO, ParameterModel.NET_PORT_PUSH));
		return DataBaseManager.getInstance().getInt(
				ParameterModel.T_PRIVATE_INFO, ParameterModel.NET_PORT_PUSH);

	}

	@Override
	public int getRestfulPort() {
		WriteLog.getInstance().writeDebugLog(context.getString(R.string.DEBUG_PRIVATE_RESTFUL_PORT)+DataBaseManager.getInstance().getInt(
				ParameterModel.T_PRIVATE_INFO, ParameterModel.NET_PORT_RESTFUL));
		return DataBaseManager.getInstance().getInt(
				ParameterModel.T_PRIVATE_INFO, ParameterModel.NET_PORT_RESTFUL);
	}

	@Override
	public String getLocalIpAddress() {
		return sPrivateNetIp;
	}
	
	public int getNetIndex() {
		return 21;
	}
	
	public void setLocalAddress(String _sNetIp) {
		this.sPrivateNetIp = _sNetIp;
	}

	@Override
	public String getLastCCT() {
		// TODO Auto-generated method stub
		return last_CTT;
	}

	@Override
	public String getLastLCT() {
		// TODO Auto-generated method stub
		return last_LCT;
	}

	@Override
	public void setLastCCT(String cct) {
		// TODO Auto-generated method stub
			this.last_CTT = cct;
	}

	@Override
	public void setLastLCT(String lct) {
		// TODO Auto-generated method stub
			this.last_LCT = lct;
	}

	@Override
	public int  getLocalSocketPort() {
		// TODO Auto-generated method stub
		return this.localSocketPort;
	}

	@Override
	public void setLocalSocketPort(int port) {
		// TODO Auto-generated method stub
		this.localSocketPort = port;
	}
	@Override
	public String getLocalSocketIp() {
		return this.localSocketIp;
	}
	@Override
	public void setLocalSocketIp(String localSocketIp) {
		this.localSocketIp = localSocketIp;
	}

}
